<?php
/**
 * Created by PhpStorm.
 * User: 1
 * Date: 2017-07-12
 * Time: 14:21
 */

namespace app\src\sunsun\common\action;


use app\src\base\action\BaseAction;

class PushLogAction extends BaseAction
{
    protected $logInterval = 600;

    /**
     * 记录推送日记，如果存在则更新时间
     * @param $uid
     * @param $did
     * @param $type
     * @return bool
     */
    public function log($uid, $did, $type)
    {
        return false;
//        $map = [
//            'uid' => $uid,
//            'did' => $did,
//            'type' => $type,
//        ];
//        $now = time();
//
//        $result = (new PushLogLogic())->getInfo($map);
//        if (ValidateHelper::legalArrayResult($result)) {
//            $id = $result['info']['id'];
//            $last_push_time = intval($result['info']['last_push_time']);
//            if ($now - $last_push_time < $this->logInterval) {
//                return true;
//            }
//            (new PushLogLogic())->saveByID($id, ['last_push_time' => $now]);
//        } elseif ($result['status']) {
//            $map['last_push_time'] = $now;
//            (new PushLogLogic())->add($map);
//        }
//
//        return false;
    }
}